<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>

<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/dopstyle.css" rel="stylesheet">


<%@page import="java.util.ArrayList"%>
<%@page import="javax.ejb.EJB"%>
<%@page import="ejb.AccountBean"%>
<%@page import="entities.Order"%>
<%@page import="repositories.OrderRepository"%>
<jsp:useBean id="userBean" class="ejb.AccountBean"/>
</head>
<body class="bg">

<% 
OrderRepository ordersRep = new OrderRepository();
ordersRep.FindAll();
ArrayList<Order> orders = ordersRep.OrderList;
String username = session.getAttribute("Username").toString();
//String username = userBean.getClient().getFirstname();
out.println(username);
out.println("<p>Вы добавили в корзину следующие заказы : </p>");	
if (orders!=null) {
%>
<div class="col-md-10 content well well-lg">
	<table class="table table-striped">
		<thead>
			<tr>
				<th>Рейс</th>
				<th>Дата заказа</th>
				<th>Класс</th>
			</tr>
		</thead>
		<tbody>


		<%
			for (int i = 0; i < orders.size(); i++) {
				if (username.equals(orders.get(i).getOrderClient().getMail()))
				{
				%>
				<tr>
					<td><%=orders.get(i).getOrderFlight().getFlightNo()%></td>
					<td><%=orders.get(i).getOrderDate()%></td>
					<td><%=orders.get(i).getFlightClass()%></td>
					
				</tr>
				<%
				}
			}
		%>

		</tbody>
	</table>
</div>
<% 
} 
%>
</body>
</html>